package com.by.controller;

import com.by.bean.Supplier;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.common.group.V;
import com.by.service.SupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "供应商")
@RequestMapping("api")
public class SupplierController extends BaseController {
    @Autowired
    SupplierService supplierService;
    @PostMapping("/supplier")
    @ApiOperation("保存")
    public ResultBean save(@Validated @RequestBody Supplier supplier, BindingResult result){
        V.validate(result);
        int rs = supplierService.save(supplier);
        return saveResult(rs);
    }
}
